/*
* @Author: haodaquan
* @Date:   2017-09-22 10:50:33
* @Last Modified by:   haodaquan
* @Last Modified time: 2017-09-22 10:50:33
*/
function CheckTimeRange(date1,date2,dur)
{   
    if(date1.length != 19 || date2.length !=19 ) 
    {
        layer.alert("请输入正确的时间范围")
        return false;
    }
    
    var starttime = date1;
    starttime = starttime.replace(new RegExp("-", "gm"), "/");
    var starttimeHaoMiao1 = (new Date(starttime)).getTime() / 1000; //得到毫秒数
  
    var starttime = date2;
    starttime = starttime.replace(new RegExp("-", "gm"), "/");
    var starttimeHaoMiao2 = (new Date(starttime)).getTime() / 1000; //得到毫秒数
  
    if ((starttimeHaoMiao2 - starttimeHaoMiao1) > (384 * 24 * 3600)) {
        layer.alert("输入时间范围请勿超过" + dur +"天")
        return false;
    }

    if((starttimeHaoMiao2 - starttimeHaoMiao1) < 0)
    {
        layer.alert("结束时间大于起始时间,请重新输入" )
        return false;
    }
    
    return true;
}

